package com.dc.project_java.test.news;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.dc.base.view.recyclerview.commonadapter.CommonRecyclerAdapter;
import com.dc.base.view.recyclerview.commonadapter.ViewHolder;
import com.dc.project_java.R;

import java.util.ArrayList;

public class NewsAdapter extends CommonRecyclerAdapter<NewsBean.StoriesBean> {

    public NewsAdapter(Context context) {
        super(context, new ArrayList<>(), R.layout.item_news);
    }

    @Override
    protected void convert(ViewHolder holder, NewsBean.StoriesBean storiesBean, int position) {
        holder.setText(R.id.text, storiesBean.getTitle())
                .setText(R.id.text1, storiesBean.getGa_prefix())
                .setImagePath(R.id.image, storiesBean.getImages().get(0), (imageView, path) -> Glide.with(imageView.getContext()).load(path).into(imageView));
    }
}
